<template>
    <div class="box">
        <div class="top">
            <h2>短信验证登录/注册</h2>
            <p>新手机号将自动注册，请详读 <span>豆瓣使用协议，豆瓣个人信息保护政策</span></p>
        </div>
        <div class="log">

            <van-form @submit="onSubmit">
                <van-cell-group inset>
                    <van-field v-model="username" name="username" label="用户名" placeholder="用户名"
                        :rules="[{ pattern, required: true, message: '请填写用户名' }]" />
                    <van-field v-model="password" type="password" name="password" label="密码" placeholder="密码"
                        :rules="[{ required: true, message: '请填写密码' }]" />
                </van-cell-group>
                <div style="margin: 16px;">
                    <van-button round block type="primary" native-type="submit">
                        提交
                    </van-button>
                    <span style="color: green;float: left;">账号密码登录</span>
                    <span style="float: right;">验证码收不到？</span>
                </div>
            </van-form>
            <p style="margin-top: 10rem;text-align: center;">第三方验证</p>
            <van-icon name="chat-o" size="4rem" color="green" />
            <van-icon name="weibo" size="4rem" color="red" />
        </div>
    </div>

</template>

<script setup>
import { ref } from 'vue';
const username = ref('');
const password = ref('');
const onSubmit = (values) => {
    console.log('submit', values);
};
let pattern = /^1[3~6]\d[9]&/;
</script>

<style lang="scss" scoped>
.box {
    width: 100%;
    height: 100%;

    .top {
        h2 {
            margin: 1rem 0;
        }

        span {
            color: green;
        }

        p {
            margin: 0 10px;
        }

        text-align: center;
    }

    .log {
        margin-top: 3rem;

        span {
            margin-top: 2rem;
        }

    }
}
</style>